Automated Cross Object Calculation
Overview
In this lab we will review how we can automate the creation of Cross Object Calculation objects (Calculation Plugin) using RNA.
In order to custom metrics in SevOne there are two main options: group poller and calculation plugin. The benefit of calculation plugin is that we can create more complex and sophisticated formulas than with group poller (mainly aggregations), however the main problem with the calculation plugin is that you need to create the formulas manually.
Now with RNA we can automate the creation of these CoC formulas with no need for scripting (PHP, Python...) or understanding the SevOne API.
In this lab we will select a group of devices where we want to create some CoC objects. This CoC object will be the sum of the In Traffic from two interfaces that are connected to internet, therefore we need to tell RNA:
where to find these devices (device group)
which CoC object type we will use to create the new CoC objects
which interfaces are the ones connected to internet
which indicators have In Traffic data
Create CoC Object
If SevOne authentication has already been created, please skip this block of actions and continue to step 4.
Log into SANO automation platform
Go to Authentications
Click Create Authentication
a. Name: SevOne
b. Service: SevOne
c. Protocol: http:// (<-- important)
d. Host: 10.0.0.10
e. Username: admin
f. Password: SevOne
Go to Workflows and click on Create Workflow
a. Name: Automatic CoC Creation
b. Layout type: Sequence
Add variables to Start
a. NMSCredentials
i. Name: NMSCredentials
ii. Type: Authentication -> SevOne
iii. Default Value: "admin/SevOne"
iv. In
v. Requiredb. CoCObjectType
i. Name: CoCObjectType
ii. Type: String
iii. Default Value: "Interface"
iv. In
v. Requiredc. CoCIndicatorType
i. Name: CoCIndicatorType
ii. Type: String
iii. Default Value: "OctetsIn"
iv. In
v. Requiredd. CoCObjectName
i. Name: CoCObjectName
ii. Type: String
iii. Default Value: "Interface Traffic"
iv. In
v. Requirede. devicegroup
i. Name: devicegroup
ii. Type: String
iii. Default Value: "CoC Internet Traffic"
iv. In
v. Requiredf. listobjects
i. Name: listobjects
ii. Type: Array
iii. Default Value: ['GigabitEthernet1/1/0/0','GigabitEthernet1/1/0/10']
iv. In
v. Requiredg. indicatorname
i. Name: indicatornames
ii. Type: Array
iii. Default Value: ["ifHCInOctets","ifInOctets"]
iv. In
v. Requiredh. tempindicatorlist
i. Name: tempindicatorlist
ii. Type: Array
iii. Default Value: []i. expression
i. Name: expression
ii. Type: String
iii. Default Value: ""
Change to Flow View
On the left hand side panel, click on SevOne -> REST v3 -> Metadata
Select "Metadata Device Groups (POST)" and drop it after the building block START
a. Change name to Find_Device_Group
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. names: click on the three vertical dots on the right side of this property and click 'Append child'
a. type: "FUZZABLE_STRING_TYPE_EXACT"
b. value: $devicegroup
Add a new building block, SevOne -> REST v3 -> Metadata -> Metadata Devices (POST)
a. Change name to Find_Devices
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. deviceGroupsIds: [ $Find_Device_Group.result.groups[0].id ]Add a new building block, SevOne -> REST v3 -> Metadata -> Metadata Object Types (POST)
a. Change name to Find_Object_Type
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. pluginId: 20,
2. names: click on the three vertical dots on the right side of this property and click 'Append child'
a. type: "FUZZABLE_STRING_TYPE_EXACT"
b. value: $CoCObjectTypeAdd a new building block, SevOne -> REST v3 -> Metadata -> Metadata Indicator Types (POST)
a. Change name to Find_Indicator_Type
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. filters: click on the three vertical dots on the right side of this property and click 'Append child'
a. plugins: [ 20 ],
b. indicatorTypeNames: click on the three vertical dots on the right side of this property and click 'Append child'
i. value: $CoCIndicatorType
c. objectTypeIds: [ $Find_Object_Type.result.objectTypes[0].id ]
Add a new building block, Common -> ForEach
a. Change name to ForEach_Device_in_Group
b. Click on the building block to open the right side panel and complete the following fields
i. list: $Find_Devices.result.devices
Add a new building block, Common -> Assign
a. Change name to Initizalize_list_variables
b. Click on the building block to open the right side panel and complete the following fields
i. variable: $tempindicatorlist
ii. value: []Add a new building block, SevOne -> REST v3 -> Object -> Objects Create COC Group
a. Change name to Create_CoC_Object
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. description: $CoCObjectName
2. deviceId: $ForEach_Device_in_Group.item.id
3. name: $CoCObjectName
4. ObjectTypeId: $Find_Object_Type.result.objectTypes[0].idAdd a new building block, Common -> ForEach
a. Change name to ForEach_object
b. Click on the building block to open the right side panel and complete the following fields
i. list: $listobjects
Add a new building block, Common -> ForEach
a. Change name to ForEach_indicatorname
b. Click on the building block to open the right side panel and complete the following fields
i. list: $indicatornames
Add a new building block, SevOne -> REST v3 -> Metadata -> Metadata Indicators (POST)
a. Change name to Find_Indicators
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. Filters: click on the three vertical dots on the right side of this property and click 'Append child'
a. deviceIds: [ $ForEach_Device_in_Group.item.id ]
b. objectNames: click on the three vertical dots on the right side of this property and click 'Append child'
i. value: $ForEach_object.item
c. indicatorTypeNames: click on the three vertical dots on the right side of this property and click 'Append child'
i. value: $ForEach_Indicatorname.itemAdd a new building block, Common -> If
a. Change name to If_indicator_found
b. Click on the building block to open the right side panel and complete the following fields
i. Condition: $Find_Indicators.result.indicators.length > 0
On the 'TRUE' branch of the If, add a new building block, SevOne -> Rest v3 -> Objects -> Objects Create COC Variable
a. Change name to Create_CoC_Variable
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. deviceId: $ForEach_Device_in_Group.item.id
2. objectName: $CoCObjectName
3. varDeviceId: $Find_Indicators.result.indicators[0].deviceId
4. varIndicatorId: $Find_Indicators.result.indicators[0].indicatorId
5. varName: $Find_Indicators.result.indicators[0].id
6. varObjectId: $Find_Indicators.result.indicators[0].objectId
7. varPluginId: $Find_Indicators.result.indicators[0].pluginIdAdd a new building block, Common -> Array -> ArrayPush
a. Change name to Save_Indicator_Name
b. Click on the building block to open the right side panel and complete the following fields
i. array: $tempindicatorlist
ii. item: $Find_Indicators.result.indicators[0].id
After the third 'END', add a new building block, Common -> Assign
a. Change name to Initialize_expression
b. Click on the building block to open the right side panel and complete the following fields
i. variable: $expression
ii. value: ''Add a new building block, Common -> ForEach
a. Change name to ForEach_Indicator
b. Click on the building block to open the right side panel and complete the following fields
i. list: $tempindicatorlist
Add a new building block, Common -> If
a. Change name to If_expression_empty
b. Click on the building block to open the right side panel and complete the following fields
i. Condition: $expression == ""
On the 'TRUE' branch of the If, add a new building block, Common -> Assign
a. Change name to Add_indicator_to_expression
b. Click on the building block to open the right side panel and complete the following fields
i. variable: $expression
ii. value: "${" + $ForEach_Indicator.item + "} "On the 'FALSE' branch of the If, add a new building block, Common -> Assign
a. Change name to Add_indicator_to_expression2
b. Click on the building block to open the right side panel and complete the following fields
i. variable: $expression
ii. value: $expression + " + ${" + $ForEach_Indicator.item + "} "After the second 'END', add a new building block, SevOne -> REST v3 -> Objects -> Objects Update COC Expression
a. Change name to Update_Expression
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body:
1. objectName: $CoCObjectName
2. deviceId: $ForEach_Device_in_Group.item.id
3. expression: $expression
4. indicatorTypeId: $Find_Indicator_Type.result.indicatorTypes[0].id
Review
In order to review how the workflow in RNA works, we need to create the device group and the CoC object type in the NMS first.
Go to the NMS -> Devices -> Grouping -> Device Groups
Click 'Add Device Group'
a. Device Group Name: CoC Internet Traffic
b. Click save
Find the device group created, click on the name and add devices by clicking on 'Pin Devices'
a. Select CHI-EDGE01 and SFO-EDGE01
b. Click 'Pin to Group'
Go to Administration -> Monitoring Configuration -> Object Types
Change Filter to Calculation Poller
a. Click on Add
i. Name: Interface
ii. Click Save as NewClick on the object type created and click on Add Atomic Indicator Type
a. Indicator Name: OctetsIn
b. Description: OctetsIn
c. Indicator Type: GAUGE
d. Measure As: Bytes
e. Display As: Bytes
f. Click Save As New
Now we are ready to test the RNA workflow.
Go back to RNA, open the workflow that you created and click Run
Go back to the NMS and go to Administration -> Monitoring Configuration -> Calculation Editor
Click on any of the objects created to see the formula and the variables created
NOTE: variable names will be different on your installation
To start collecting data on this new object, we need to rediscover the device
Go to Devices -> Device Manager
a. Find devices CHI-EDGE01 and SFO-EDGE01
b. Click on the 'gear' icon -> Discovery -> Discover
After a few (5-10) minutes, data should start being populated on the new Internet Traffic object